/*
package com.luoc.base.service.impl;


import com.tqds.idol.mapper.FlowerGiveLog1Mapper;
import com.tqds.idol.mapper.FlowerStealLog1Mapper;
import com.tqds.idol.utils.DateUtils;
import com.tqds.idol.utils.RedisUtils;
import com.tqds.idol.websocket.service.GuildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

*/
/**
 * @Author: luoc
 * @Date: 2019/7/19 9:29
 *//*

@Service("guildServiceImpl")
public class GuildServiceImpl implements GuildService {

    @Autowired
    RedisUtils redisUtils;

    @Autowired
    FlowerStealLog1Mapper flowerStealLog1Mapper;

    @Autowired
    FlowerGiveLog1Mapper flowerGiveLog1Mapper;

    @Override
    public List<Map<String,Object>> getFlowerChangeListFromRedis(String mid) {
         String name = "guild_flower_change_queue_" + mid;
         List<Map<String,Object>> giveLogList = new ArrayList<>();
         List<Map<String,Object>> stealLogList = new ArrayList<>();
        if (redisUtils.lLen(name) < 10){
            if (Integer.valueOf(mid) > 0){
                giveLogList = flowerGiveLog1Mapper.selectLogForWsLogin(Integer.valueOf(mid));
                stealLogList = flowerStealLog1Mapper.selectLogForWsLogin(Integer.valueOf(mid));
            }
        }
        giveLogList.addAll(stealLogList);
        // 按照更新时间进行排序
        giveLogList.sort((o1, o2) -> {
            Long o1creatTime = (Long) o1.get("create_time");
            Long o2creatTime = (Long) o2.get("create_time");
            return o1creatTime.intValue() - o2creatTime.intValue();
        });

        if (giveLogList.size() > 0){
            for (Map<String,Object> tempMap: giveLogList) {
                tempMap.putIfAbsent("img", "/image/no-head.png");
                tempMap.put("create_time", DateUtils.format((Date) tempMap.get("create_time"),"HH:mm:ss"));
            }
        }
        return giveLogList;
    }

    @Override
    public   List<Map<String,Object>> getGuildMsgListFromRedis(String mid) {
         String name = "guild_msg_queue_" + mid;
          return  redisUtils.lrange(name);
    }


}
*/
